package io.mft.flow.core.executable.drive.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.mft.commons.function.ExecuteReturn;
import io.mft.flow.core.executable.ChainCondition;
import io.mft.flow.core.executable.drive.ChainConditionDriver;
import io.mft.flow.core.executable.drive.ConditionDriveSourceProvider;
import io.mft.flow.core.executable.drive.ConditionDriverType;
import io.mft.flow.data.ChainContext;

/**
 * 非结果集驱动，即前驱节点执行完成时直接触发后继节点执行
 * 
 * @说明：TODO
 * @类型名称：NoneDeliverReturnChainConditionDriver
 * @创建者: 胡常建
 * @创建时间: 2021年3月4日 上午8:47:03
 * @修改者: 胡常建
 * @修改时间: 2021年3月4日 上午8:47:03
 */
public class NoneDeliverReturnChainConditionDriver extends ChainConditionDriver {

	Logger logger = LoggerFactory.getLogger(getClass());

	
	@Override
	public ExecuteReturn drive(ChainContext context,ConditionDriveSourceProvider conditionDriveSourceProvider) throws Exception {
		ChainCondition chainCondition=chainCondition();
		ChainCondition nextChainCondition=chainCondition.getNextChainCondition();
		logger.debug("ChainConditionDriver->>>逻辑单元编排Chain:{}->>>非结果集逻辑单元驱动-当前逻辑单元:{} 类型:{}->>>下一个逻辑单元:{} 类型:{}",chainCondition.getChain().getChainId(),chainCondition.note(),chainCondition.getCondition().conditionType(),nextChainCondition.note(),nextChainCondition.getCondition().conditionType());
		ExecuteReturn executeReturn =executeNextChainCondition(context, nextChainCondition, context.getRequest(), context.getResponse());
		return executeReturn;
	}
	@Override
	public ConditionDriverType conditionDriverType() {
		return ConditionDriverType.noneDeliverReturn;
	}
	

}
